/*
 *
 * Copyright (C) 2012 Walter L�tgenau
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package offset.nodes.client.dialog.navigation.view;

import java.awt.CardLayout;

/**
 * Let's select a node from the repository.
 * The chooser uses XPATH queries to determine the nodes to be displayed. It will display only nodes returned from the query and the path
 * to these nodes.
 * 
 * @author  Walter Luetgenau
 */
public class NavigationPanel extends javax.swing.JPanel {

    String cardName = null;
    
    /**
     * A new node chooser panel.
     * 
     */
    public NavigationPanel() throws Exception {
        initComponents();
    }
    
    public void addCard(AbstractCardPanel panel) {
        add(panel, panel.getCardName());
    }
    
    /**
     * Show the requested card.
     * 
     * @param cardName the name of the card
     */
    public void showCard(String cardName) {
        ((CardLayout) getLayout()).show(this, cardName);
        this.cardName = cardName;
    }
    
    /**
     * Return the name of the current card.
     * 
     * @return the current card name
     */
    public String getCurrentCard() {
        return cardName;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setLayout(new java.awt.CardLayout());
    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables
}
